DAC 24 Click
DAC 24 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Mar 2026.
- Type : SPI type
Software Support
Example Description
This example demonstrates the control of DAC output voltage using the DAC 24 Click board. The application sequentially increases the DAC output voltage on all channels in equal steps.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.DAC24
Example Key Functions
- dac24_cfg_setup This function initializes Click configuration structure to initial values.
void dac24_cfg_setup(dac24_cfg_t *cfg)
DAC 24 configuration object setup function.
DAC 24 Click configuration object.
Definition dac24.h:184
- dac24_init This function initializes all necessary pins and peripherals used for this Click board.
err_t dac24_init(dac24_t *ctx, dac24_cfg_t *cfg)
DAC 24 initialization function.
DAC 24 Click context object.
Definition dac24.h:171
- dac24_set_power_down This function sets the device in the selected power down mode.
err_t dac24_set_power_down(dac24_t *ctx, uint8_t pwr)
DAC 24 set power down function.
- dac24_set_dac_value This function writes the 8-bit DAC code value to one or more channels.
err_t dac24_set_dac_value(dac24_t *ctx, uint8_t channel, uint8_t value)
DAC 24 set DAC value function.
- dac24_set_dac_voltage This function sets the output voltage (in millivolts) for one or more channels.
err_t dac24_set_dac_voltage(dac24_t *ctx, uint8_t channel, uint16_t voltage_mv)
DAC 24 set DAC voltage function.
Application Init
Initializes the driver and logger.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( SPI_MASTER_ERROR ==
dac24_init( &dac24, &dac24_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define DAC24_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition dac24.h:157
void application_init(void)
Definition main.c:31
Application Task
Gradually increases the DAC output voltage on all channels in equal steps every 2 seconds.
{
uint16_t output_voltage = step;
{
{
log_printf ( &logger, " All channels output voltage set to %u mV\r\n", output_voltage );
}
output_voltage += step;
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
}
@ DAC24_OK
Definition dac24.h:204
#define DAC24_CHANNEL_ALL
DAC 24 output channel selection.
Definition dac24.h:101
#define DAC24_VCC_LEVEL
Definition dac24.h:128
#define NUMBER_OF_STEPS
Definition main.c:26
void application_task(void)
Definition main.c:61
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.